package com.example.project.manageController;

import com.example.project.dao.ParkingTypeDAO;
import com.example.project.pojo.ParkingType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping("manage")
public class ManageAddParking_typeController {
    @RequestMapping("addParking_type")
    public String addParking_type() {
        return "manage/addparking_type";
    }

    @PostMapping("addPark")
    public String addPark(String type_name, double money) {

        ParkingType parkingType = new ParkingType();
        parkingType.setTypeName(type_name);
        parkingType.setMoney(money);
        ParkingTypeDAO parkingTypeDAO = new ParkingTypeDAO();
        parkingTypeDAO.addPark(parkingType);

        return "redirect:/manage/addParking_type";
    }
}
